<template>
	<view class="orderRefund-content">
		<view class="orderRefund-box">
			<view class="order-box">
				<view>订单号</view>
				<view>{{formData.orderNo}}</view>
			</view>
			<view class="reason-box">
				<view class="reason-title">
					退款原因
				</view>
				<view>
					<textarea v-model="formData.reason" placeholder="请填写退款原因!" cols="30" rows="10"></textarea>
				</view>
			</view>
		</view>
		<view class="submit-btn">
			<u-button type="primary" shape="circle" @click="submit">提交退款</u-button>
		</view>
	</view>
</template>

<script>
	import {
		HouseRefund
	} from "@/api/index.js"
	export default {
		data() {
			return {
				formData: {
					orderNo: '',
					reason: ''
				}
			}
		},
		onLoad(op) {
			this.formData.orderNo = op.orderNo
		},
		methods: {
			submit() {
				if (this.formData.reason == '') {
					uni.showToast({
						title: '请填写退款原因！',
						icon: 'error'
					})
					return
				}
				HouseRefund(this.formData).then(res => {
					uni.showToast({
						title: '退款申请成功，请等待审核',
						duration: 800
					})
					setTimeout(() => {
						uni.navigateBack()
					}, 1000)
				})
			}
		}
	}
</script>

<style lang="scss">
	.order-box {
		width: 95%;
		margin: 20rpx auto;
		background-color: #fff;
		border-radius: 10rpx;
		display: flex;
		padding: 15rpx 20rpx;
		justify-content: space-between;
	}

	.reason-box {
		width: 95%;
		margin: 20rpx auto;
		background-color: #fff;
		border-radius: 10rpx;
		padding: 15rpx 20rpx;

		.reason-title {
			margin-bottom: 10rpx;
			font-size: 34rpx;
			font-weight: bold;
		}
	}

	.submit-btn {
		width: 95%;
		position: fixed;
		bottom: 30rpx;
		left: 2.5%;

	}
</style>